import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common';
import { FeedbackService } from './feedback.service';
import { CreateFeedbackDto, SolveType } from './dto/create-feedback.dto';
import { RequireLogin, UserInfo } from 'src/common/decorator';

@Controller('feedback')
@RequireLogin()
export class FeedbackController {
  constructor(private readonly feedbackService: FeedbackService) {}

  @Post()
  create(@Body() createFeedbackDto: CreateFeedbackDto, @UserInfo('userId') userId: string) {
    return this.feedbackService.create(createFeedbackDto, userId);
  }

  @Get()
  findAll(@UserInfo('userId') userId: string) {
    return this.feedbackService.findAll(userId);
  }

  @Patch(':id')
  solve(@Param('id') id: string, @Query('replyContent') replyContent: string, @Query('solveType') solveType: SolveType) {
    return this.feedbackService.solve(id, replyContent, solveType);
  }
}
